import u from "../utils";
import {FILLIN} from "../constants";
import fetch from "../utils/fetch";

const _api = u.api(FILLIN);
const _fetch = fetch(FILLIN);

export default {
  getPageInfo: shortkey => _api('getPageInfo', { data: { key: shortkey } }),
  submit: data => {
    return _fetch('submit', {
      method: 'post',
      body: data
    });
  },
  update: data => {
    return _fetch('update', {
      method: 'post',
      body: data
    });
  },
  getThirdPartyConfig: (key, url) => _api('jssdk', {
    type: 'post',
    data: { key, url },
  }),
  getRules: shortkey => _api('rules', { data: { key: shortkey } }),
  check: shortkey => _api('check',{ data: { key: shortkey } }),
  uploadFile: data => {
    return _fetch('uploadFile', {
      method: 'post',
      body: data
    });
  },
  modifyRemark: data => {
    return _fetch('modifyRemark', {
      method: 'post',
      body: data
    });
  },
    genOauthKey: code => _api('genOauthKey', { data: { oauthCode: code } })

}